
package com.trydofor.id.a9ic;

import javax.annotation.concurrent.Immutable;

import com.trydofor.id.a9id.A9ID;
import com.trydofor.id.core.A9DU;
import com.trydofor.id.core.A9Maker;
import com.trydofor.id.core.ApiExceptions;
import com.trydofor.id.core.Range;

/**
 * Abstract A9ic Maker.
 * 
 * @author Shi Rongjiu (www.trydofor.com)
 * @since 0.9
 */
@Immutable
public abstract class A9icAbstractMaker implements A9Maker<A9IC>, A9DU {
    
    /**
     * the default serial start with
     */
    public static final long SERIAL_STARTWITH = 1;
    
    /**
     * the default serial increment
     */
    public static final int  SERIAL_INCREMENT = 1;
    
    /**
     * the worker
     */
    protected final int      worker;
    
    /**
     * hold and check worker
     * 
     * @param worker the worker
     * @throws IllegalArgumentException if worker out of range
     */
    protected A9icAbstractMaker(int worker) {
        Range rwk = A9ID.getRangeOfWorker();
        ApiExceptions.checkRangeNotContains(rwk, worker);
        this.worker = worker;
    }
    
    /**
     * {@inheritDoc}
     */
    public int getWorker() {
        return worker;
    }
}
